/**
 *
 */
package com.cht.sys.security;

import java.io.Serializable;
import java.security.Principal;

/**
 * @author Administrator
 *
 */
public class MBMSPrincipal implements Principal, Serializable {

	private static final long serialVersionUID = -7115591566560852433L;
	private String name;

	public MBMSPrincipal(String name) {
		if (name == null)
			throw new NullPointerException("illegal null input");

		this.name = name;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.security.Principal#getName()
	 */
	public String getName() {
		return name;
	}

	public String toString() {
		return ("MBMSPrincipal:  " + name);
	}

	public boolean equals(Object o) {
		if (o == null)
			return false;

		if (this == o)
			return true;

		if (!(o instanceof MBMSPrincipal))
			return false;

		MBMSPrincipal that = (MBMSPrincipal) o;

		if (this.getName().equals(that.getName()))
			return true;

		return false;
	}

	public int hashCode() {
		return name.hashCode();
	}
}
